package org.budo.cmbc.direct.sdk.entity;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * @author lmw
 */
@Getter
@Setter
@Accessors(chain = true)
@NoArgsConstructor
public class MEAccountOpenResponse extends AbstractCmbcDirectResponse {
    private static final long serialVersionUID = 3572385319786846409L;

    /**
     * 预开户号
     */
    private String eAccountOpenJnlNo;

    /**
     * 处理状态 00-开户成功,01-开户失败，02-开户正在处理中
     */
    private String eAcNoStatus;

    // 电子账户协议编号
    private String eProtocolAcNo;

    private String eAcNo;

    // 渠道请求流水号
    private String channelJnlNo;

    // 收款三类户电子账户协议编号
    private String shadowEProtocolAcNo;

    // 收款三类户账户号
    private String shadowEAcNo;

    // 是否已开通入金通道
    private String isOpenBankInnerPath;

    public MEAccountOpenResponse(String channelJnlNo, String responseJson) {
        super(channelJnlNo, responseJson);

        JSONObject jsonObject = JSON.parseObject(responseJson);
        this.setEAccountOpenJnlNo(jsonObject.getString("EAccountOpenJnlNo"));
        this.setEAcNoStatus(jsonObject.getString("EAcNoStatus"));
        this.setEProtocolAcNo(jsonObject.getString("EProtocolAcNo"));
        this.setChannelJnlNo(jsonObject.getString("ChannelJnlNo"));

        this.setShadowEProtocolAcNo(jsonObject.getString("ShadowEProtocolAcNo"));
        this.setShadowEAcNo(jsonObject.getString("ShadowEAcNo"));

        this.setIsOpenBankInnerPath(jsonObject.getString("IsOpenBankInnerPath"));
        this.setEAcNo(jsonObject.getString("EAcNo"));
    }
}